<template>
	<section>
		<!--工具条-->
		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true" :model="filters">
				<el-form-item>
					<el-input v-model="filters.f_stairpricename" placeholder="阶梯气价名称"></el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" v-on:click="searchOneStairPrices">查询</el-button>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" @click="addStairPrice">新增</el-button>
				</el-form-item>
			</el-form>
		</el-col>

		<!--列表-->
		<el-table :data="stairprices" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;">
			<el-table-column type="selection" width="55">
			</el-table-column>
			<el-table-column type="index" width="60">
			</el-table-column>
			<el-table-column prop="f_stairpricename" label="价格名称" width="120" sortable>
			</el-table-column>
			<el-table-column prop="f_stairpricecount" label="气价个数" width="120"  sortable>
			</el-table-column>
			<el-table-column prop="f_staironepriceone" label="单价一" width="100"  sortable>
			</el-table-column>
			<el-table-column prop="f_staironegasone" label="气量一" width="100"  sortable>
			</el-table-column>
			<el-table-column prop="f_staironepricetwo" label="单价二" width="100"  sortable>
			</el-table-column>
			<el-table-column prop="f_staironegastwo" label="气量一" width="100"  sortable>
			</el-table-column>
			<el-table-column prop="f_staironepricethree" label="单价三" width="100"  sortable>
			</el-table-column>
			<el-table-column prop="f_staironenewpriceone" label="新单价一" width="100"  sortable>
			</el-table-column>
			<el-table-column prop="f_staironenewgasone" label="新气量一" width="100"  sortable>
			</el-table-column>
			<el-table-column prop="f_staironenewpricetwo" label="新单价二" width="100"  sortable>
			</el-table-column>
			<el-table-column prop="f_staironenewgastwo" label="新气量二" width="100"  sortable>
			</el-table-column>
			<el-table-column prop="f_staironenewpricethree" label="新单价三" width="100"  sortable>
			</el-table-column>
			<el-table-column prop="f_staircreatedate" label="设立日期" width="120" sortable>
			</el-table-column>
			<el-table-column prop="f_staircreateoperator" label="设立人" width="120" sortable>
			</el-table-column>			
			<el-table-column label="操作" width="150">
				<template slot-scope="scope">
					<el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
					<el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button>
				</template>
			</el-table-column>
		</el-table>

		<!--工具条-->
		<el-col :span="24" class="toolbar">
			<el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button>
			<el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="20" :total="total" style="float:right;">
			</el-pagination>
		</el-col>

		<!--增加界面-->
		<el-dialog title="增加" v-model="editFormVisible" :close-on-click-modal="false">
			<el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm" >
				<el-form-item label="价格名称" prop="f_stairpricename">
					<el-input v-model="editForm.f_stairpricename" auto-complete="off"></el-input>
				</el-form-item>
				<el-form-item label="阶梯个数">
					<el-radio-group v-model="editForm.f_stairpricecount" @change="changeEditPriceRow()">
						<el-radio class="radio" :label="1">1</el-radio>
						<el-radio class="radio" :label="2">2</el-radio>
						<el-radio class="radio" :label="3">3</el-radio>
						<el-radio class="radio" :label="4">4</el-radio>
					</el-radio-group>
				</el-form-item>
				<el-form-item label="建立人">
					<el-col :span="3">
						<el-input type="text" v-model="editForm.f_staircreateoperator"></el-input>
					</el-col>
				</el-form-item>
						
			
				<el-row class="editrowtitle" v-show="rowoneshow"  align="center">
					<el-col  :span="2" >
							<el-input type="toolbar"  :disabled="false" placeholder="序号" >1</el-input>				
					</el-col>
					<el-col :span="2">
							<el-input placeholder="单价一" :disabled="false" ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="气量一" :disabled="false" ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="单价二" :disabled="false"  ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="气量二" :disabled="false"  ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="单价三" :disabled="false"   ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="新单价一" :disabled="false"   ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="新气量一"  :disabled="false"  ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="新单价二" :disabled="false"  ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="新气量二" :disabled="false"   ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="新单价三" :disabled="false"   ></el-input>
					</el-col>
				</el-row>
				<el-row class="editrowone" v-show="rowoneshow" align="center">
					<el-col  :span="2" >	
							<el-input type="text"   v-model="editForm.f_staironeflag" :value="1" >1</el-input>				
					</el-col>
					<el-col :span="2">
							<el-input   v-model="editForm.f_staironepriceone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input   v-model="editForm.f_staironegasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input  v-model="editForm.f_staironepricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input   v-model="editForm.f_staironegastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input  v-model="editForm.f_staironepricethree"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input   v-model="editForm.f_staironenewpriceone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input  v-model="editForm.f_staironenewgasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input   v-model="editForm.f_staironenewpricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input   v-model="editForm.f_staironenewgastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input   v-model="editForm.f_staironenewpricethree"></el-input>
					</el-col>
				</el-row>
				<el-row class="editrowtwo"  v-show="rowtwoshow">
					<el-col  :span="2" >	
							<el-input type="text" v-model="editForm.f_stairtwoflag" :value="1" >1</el-input>				
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairtwopriceone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairtwogasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairtwopricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairtwogastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairtwopricethree"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairtwonewpriceone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairtwonewgasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairtwonewpricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairtwonewgastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairtwonewpricethree"></el-input>
					</el-col>
				</el-row>
				<el-row class="editrowthree"  v-show="rowthreeshow">
					<el-col  :span="2" >	
							<el-input type="text" v-model="editForm.f_stairthreeflag" :value="1" >1</el-input>				
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairthreepriceone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairthreegasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairthreepricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairthreegastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairthreepricethree"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairthreenewpriceone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairthreenewgasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairthreenewpricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairthreenewgastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairthreenewpricethree"></el-input>
					</el-col>
				</el-row>
				<el-row class="editrowfour"  v-show="rowfourshow">
					<el-col  :span="2" >	
							<el-input type="text" v-model="editForm.f_stairfourflag" :value="1" >1</el-input>				
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairfourpriceone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairfourgasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairfourpricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairfourgastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairfourpricethree"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairfournewpriceone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairfournewgasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairfournewpricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairfournewgastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="editForm.f_stairfournewpricethree"></el-input>
					</el-col>
				</el-row>
			
			</el-form>
		

			<div slot="footer" class="dialog-footer">
				<el-button @click.native="editFormVisible = false">取消</el-button>
				<el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button>
			</div>
		</el-dialog>

		<!--编辑界面-->
		<el-dialog title="编辑" v-model="addFormVisible" :close-on-click-modal="false">
			<el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm">
				<el-form-item label="价格名称" prop="f_stairpricename">
					<el-input v-model="addForm.f_stairpricename" auto-complete="off"></el-input>
				</el-form-item>
				<el-form-item label="阶梯个数">
					<el-radio-group v-model="addForm.f_stairpricecount" @change="changeAddPriceRow()">
						<el-radio class="radio" :label="1">1</el-radio>
						<el-radio class="radio" :label="2">2</el-radio>
						<el-radio class="radio" :label="3">3</el-radio>
						<el-radio class="radio" :label="4">4</el-radio>
					</el-radio-group>
				</el-form-item>
				<el-form-item label="建立人">
					<el-col :span="3">
						<el-input type="text" v-model="addForm.f_staircreateoperator"></el-input>
					</el-col>
				</el-form-item>
						
			
				<el-row class="editrowtitle" v-show="true"  align="center">
					<el-col  :span="2" >
							<el-input type="toolbar"  :disabled="false" placeholder="序号" >1</el-input>				
					</el-col>
					<el-col :span="2">
							<el-input placeholder="单价一" :disabled="false" ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="气量一" :disabled="false" ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="单价二" :disabled="false"  ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="气量二" :disabled="false"  ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="单价三" :disabled="false"   ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="新单价一" :disabled="false"   ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="新气量一"  :disabled="false"  ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="新单价二" :disabled="false"  ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="新气量二" :disabled="false"   ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input placeholder="新单价三" :disabled="false"   ></el-input>
					</el-col>
				</el-row>
				<el-row class="editrowone" v-show="rowoneaddshow" align="center">
					<el-col  :span="2" >	
							<el-input type="text"   v-model="addForm.f_staironeflag" :value="1" >1</el-input>				
					</el-col>
					<el-col :span="2" >
							<el-input class="isnullprice"  v-model="addForm.f_staironepriceone"   ></el-input>
					</el-col>
					<el-col :span="2">
							<el-input  class="isnullprice" v-model="addForm.f_staironegasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice" v-model="addForm.f_staironepricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice"  v-model="addForm.f_staironegastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice" v-model="addForm.f_staironepricethree"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice"  v-model="addForm.f_staironenewpriceone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice" v-model="addForm.f_staironenewgasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice"  v-model="addForm.f_staironenewpricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input  class="isnullprice" v-model="addForm.f_staironenewgastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input  class="isnullprice" v-model="addForm.f_staironenewpricethree"></el-input>
					</el-col>
				</el-row>
				<el-row class="editrowtwo"  ref="testreset"  v-show="rowtwoaddshow">
					<el-col  :span="2" >	
							<el-input type="text" id="isnullprice"  v-model="addForm.f_stairtwoflag" :value="1" >1</el-input>				
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice"  v-model="addForm.f_stairtwopriceone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice"  v-model="addForm.f_stairtwogasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice"  v-model="addForm.f_stairtwopricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice"  v-model="addForm.f_stairtwogastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice"  v-model="addForm.f_stairtwopricethree"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice"  v-model="addForm.f_stairtwonewpriceone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice"  v-model="addForm.f_stairtwonewgasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice"  v-model="addForm.f_stairtwonewpricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice"  v-model="addForm.f_stairtwonewgastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input class="isnullprice"   v-model="addForm.f_stairtwonewpricethree"></el-input>
					</el-col>
				</el-row>
				<el-row class="editrowthree"  v-show="rowthreeaddshow">
					<el-col  :span="2" >	
							<el-input type="text" v-model="addForm.f_stairthreeflag" :value="1" >1</el-input>				
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairthreepriceone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairthreegasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairthreepricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairthreegastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairthreepricethree"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairthreenewpriceone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairthreenewgasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairthreenewpricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairthreenewgastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairthreenewpricethree"></el-input>
					</el-col>
				</el-row>
				<el-row class="editrowfour"  v-show="rowfouraddshow">
					<el-col  :span="2" >	
							<el-input type="text" v-model="addForm.f_stairfourflag" :value="1" >1</el-input>				
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairfourpriceone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairfourgasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairfourpricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairfourgastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairfourpricethree"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairfournewpriceone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairfournewgasone"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairfournewpricetwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairfournewgastwo"></el-input>
					</el-col>
					<el-col :span="2">
							<el-input v-model="addForm.f_stairfournewpricethree"></el-input>
					</el-col>
				</el-row>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click.native="addFormVisible = false">取消</el-button>
				<el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button>
			</div>
		</el-dialog>
	</section>
</template>

<script>
	import util from '../../common/js/util'
	//import NProgress from 'nprogress'
	import { setStairPrice, getAllStairPrice, searchStairPrice, updateStairPrice,removeStairPrice } from '../../api/api';

	export default {
		data() {
			return {
				loginuser: '',
				filters: {
					name: ''
				},
				rowoneshow: false,
				rowtwoshow: false,
				rowthreeshow: false,
				rowfourshow: false,
				rowoneaddshow: false,
				rowtwoaddshow: false,
				rowthreeaddshow: false,
				rowfouraddshow: false,
				users: [],
				stairprices:[],
				total: 0,
				page: 1,
				listLoading: false,
				sels: [],//列表选中列

				editFormVisible: false,//编辑界面是否显示
				editLoading: false,
				editFormRules: {
					f_stairpricename: [
						{ required: true, message: '请输入阶梯名称', trigger: 'blur' }
					],
					f_staironepriceone:[
						{ required: true, message: '请输入阶梯名称', trigger: 'blur' }
					]
				},
				//编辑界面数据
				editForm: {
					f_stairpricename: '',
					f_stairpricecount: 1,
					f_staironeflag: 1,
					f_stairtwoflag: 2,
					f_stairthreeflag: 3,
					f_stairfourflag: 4,
				
				},

				addFormVisible: false,//新增界面是否显示
				addLoading: false,
				addFormRules: {
					name: [
						{ required: true, message: '请输入姓名', trigger: 'blur' }
					]
				},
				//新增界面数据
				addForm: {
					f_staironeflag: 1,
					f_stairtwoflag: 2,
					f_stairthreeflag: 3,
					f_stairfourflag: 4,
				}

			}
		},
		methods: {
			changeEditPriceRow: function(){
			
				var selectedRadio = this.editForm.f_stairpricecount;
				switch (selectedRadio) {
					case 1:
						this.rowoneshow = true;
						this.rowtwoshow = false;
						
						this.rowthreeshow = false;
						this.rowfourshow = false;
						break;
					case 2:
						this.rowoneshow = true;
						this.rowtwoshow = true;
						this.rowthreeshow = false;
						this.rowfourshow = false;
						break;
					case 3:
						this.rowoneshow = true;
						this.rowtwoshow = true;
						this.rowthreeshow = true;
						this.rowfourshow = false;
						break;
					case 4:
						this.rowoneshow = true;
						this.rowtwoshow = true;
						this.rowthreeshow = true;
						this.rowfourshow = true;
						break;
					default:
						break;
				}
				
			},
			changeAddPriceRow: function(){
				//.log("1");
				var selectedRadio = this.addForm.f_stairpricecount;
				//console.log(selectedRadio);
				switch (selectedRadio) {
					case 1:
						this.rowoneaddshow = true;
						this.rowtwoaddshow = false;
						
						this.rowthreeaddshow = false;
						this.rowfouraddshow = false;
						break;
					case 2:
						this.rowoneaddshow = true;
						this.rowtwoaddshow = true;
						this.rowthreeaddshow = false;
						this.rowfouraddshow = false;
						break;
					case 3:
						this.rowoneaddshow = true;
						this.rowtwoaddshow = true;
						this.rowthreeaddshow = true;
						this.rowfouraddshow = false;
						break;
					case 4:
						this.rowoneaddshow = true;
						this.rowtwoaddshow = true;
						this.rowthreeaddshow = true;
						this.rowfouraddshow = true;
						break;
					default:
						break;
				}
				//判断
				var allinput = document.getElementsByClassName("isnullprice");
	
				
				
			},
			//获取全部阶梯列表
			getStairPrices: function(){
				let para= {};
				this.loading = true;
				getAllStairPrice(para).then((res)=>{
					this.stairprices = res.data;
					this.loading = false;
				});
			},
			//查询单个阶梯
			searchOneStairPrices:function(){

			},
			//显示新增界面
			addStairPrice: function(index , row ){
				this.editFormVisible = true;
				this.changeEditPriceRow();
			},
				//显示编辑界面
			handleEdit: function (index, row) {
				this.addFormVisible = true;
				//console.log(Object.assign({}, row));
				this.addForm = Object.assign({}, row);
				this.changeAddPriceRow();
			
			},
			handleCurrentChange(val) {
				this.page = val;
				this.getUsers();
			},
			//删除
			handleDel: function (index, row) {
				this.$confirm('确认删除该记录吗?', '提示', {
					type: 'warning'
				}).then(() => {
					this.listLoading = true;
					//NProgress.start();
					let para = { id: row.id };
					removeStairPrice(para).then((res) => {
						this.listLoading = false;
						//NProgress.done();
						this.$message({
							message: '删除成功',
							type: 'success'
						});
						this.getStairPrices();
					});
				}).catch(() => {

				});
			},
		
			//增加阶梯气价
			editSubmit: function () {
				this.$refs.editForm.validate((valid) => {
					if (valid) {
						this.$confirm('确认提交吗？', '提示', {}).then(() => {
							this.editLoading = true;
							let para = Object.assign({}, this.editForm);
							//console.log(para);
							setStairPrice(para).then((res) => {
								this.editLoading = false;
								if(res.data=='createstairpricesuccess'){
								this.$message({
									message: '创建阶梯气价成功',
									type: 'success'
								});
								this.editFormVisible = false;
								this.getStairPrices();
								}else{
									this.$message({
									message: '创建阶梯气价失败',
									type: 'error'
								});
								}
								this.$refs['editForm'].resetFields();
							});
						});
					}
				});
			},
			//新增
			addSubmit: function () {
				this.$refs.addForm.validate((valid) => {
					if (valid) {
						this.$confirm('确认提交吗？', '提示', {}).then(() => {
							this.addLoading = true;
							//NProgress.start();
							let para = Object.assign({}, this.addForm);
							updateStairPrice(para).then((res) => {
								this.addLoading = false;
								//NProgress.done();
								this.$message({
									message: '提交成功',
									type: 'success'
								});
								this.$refs['addForm'].resetFields();
								this.addFormVisible = false;
								this.getStairPrices();
							});
						});
					}
				});
			},
			selsChange: function (sels) {
				this.sels = sels;
			},
			//批量删除
			batchRemove: function () {
				var ids = this.sels.map(item => item.id).toString();
				this.$confirm('确认删除选中记录吗？', '提示', {
					type: 'warning'
				}).then(() => {
					this.listLoading = true;
					//NProgress.start();
					let para = { ids: ids };
					batchRemoveStairPirce(para).then((res) => {
						this.listLoading = false;
						//NProgress.done();
						this.$message({
							message: '删除成功',
							type: 'success'
						});
						this.getStairPrices();
					});
				}).catch(() => {

				});
			}
		},
		mounted() {
		//	this.getUsers();
			this.editForm.f_stairpricecount = 1;
			this.getStairPrices();
			var user = sessionStorage.getItem('user');
			if (user) {
				user = JSON.parse(user);
				this.editForm.f_staircreateoperator  = user.name || '';			
			  }
		}
	}

</script>

<style slot-scope>
	.editrowone>.el-col,.editrowtwo>.el-col,.editrowthree>.el-col,.editrowfour>.el-col{
		margin:1px ;
		width: 78px;
		font-size:small;
	}
	.editrowtitle>.el-col{
		margin:1px;
		width: 78px;
		font-size:small;
		border-color: black;	
	}
	.editrowtitle>.el-col>.el-input{
		font-size: 13px;
		font-weight:300;
		border-color: white;
	}
	.el-input{
		text-align: center;
		
	}
	:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
    color: #000; opacity:1; 
	}
</style>